#include "udpClient.hpp"
#include <memory>

using namespace client;

/* 
客户端连接服务器，必须要知道服务器的IP，广域网通信中的是公网IP，本地是127.0.0.1即可
./udpClient server_ip server_port 
*/

void Usage(const std::string& proc)
{
    std::cerr << "\nUsage:\n\t" << proc << " server_ip server_port" << std::endl << std::endl;
}

int main(int argc, char* argv[])
{
    if(argc != 3)
    {
        Usage(argv[0]);
        exit(USAGE_ERROR);
    }

    // 1.
    std::string server_ip = argv[1];
    uint16_t server_port = atoi(argv[2]);
    std::unique_ptr<udpClient> ucli(new udpClient(server_ip, server_port));

    // 2.
    ucli->initClient();

    // 3. 
    ucli->run();

    return 0;
}